<template>
  <div style="height: 100%;">
    <el-row>
      <el-col :span="24">
        <el-menu
            :default-active="menu_key"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
            @select="get_menu"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b"
            :collapse="isCollapse"
        >
          <h5 class="title">Wx Build</h5>
          <el-menu-item index="1">
            <i class="el-icon-user-solid"></i>
            <span slot="title">用户管理</span>
          </el-menu-item>
          <el-menu-item index="2">
            <i class="el-icon-menu"></i>
            <span slot="title">小程序管理</span>
          </el-menu-item>
          <el-menu-item index="3">
            <i class="el-icon-notebook-2"></i>
            <span slot="title">项目管理</span>
          </el-menu-item>
          <el-menu-item index="4">
            <i class="el-icon-s-order"></i>
            <span slot="title">构建记录</span>
          </el-menu-item>
        </el-menu>

      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  props: ["menu_key","isCollapse"],
  // eslint-disable-next-line vue/multi-word-component-names
  name: "Menu",
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    get_menu(index) {
      switch (index) {
        case "1":
          this.$router.push("/")
          return;
        case "2":
          this.$router.push("/wx/app")
          return;
        case "3":
          this.$router.push("/project")
          return;
        case "4":
          this.$router.push("/task")
          return;
        default:
          this.$router.push("/")
          return;

      }
    }
  }
}
</script>

<style scoped>
.el-menu-vertical-demo{
  height: 100vh;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
}
.title{
  color: white;
  text-align: center;
  margin: 0;
  line-height: 60px;
}
</style>